package patterns.visitor;

/**
 * Created by thinkpad on 16-12-10.
 * 元素接口的具体实现类
 */
public class Computer implements ComputerPart {
    ComputerPart[] parts;

    public Computer() {
        parts = new ComputerPart[]{new Mouse(),new Keyboard(),new Monitor()};
    }

    @Override
    public void accept(ComputerPartVisitor visitor) {
        for (ComputerPart part :                parts) {
            part.accept(visitor);
        }
        visitor.visit(this);
    }
}
